package com.yanqu.road.server.timer.minewar;

import com.yanqu.road.server.manger.player.MineWarMgr;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


public class CheckMinePitOverTimeTask extends GeneralTask {

	private Logger logger = LogManager.getLogger(this.getClass().getName());

	private boolean isRun = false;

	private final long CHECK_TIME = 300000;   //5分钟

	private long lastCheckTime;

	@Override
	public void doRun() {
		long nowTime = System.currentTimeMillis();
		if(nowTime - lastCheckTime > CHECK_TIME && !isRun) {
			isRun = true;
			try {
				MineWarMgr.checkDispatchOverTime();
				lastCheckTime = nowTime;
			}catch (Exception e){
				logger.error("check mine pit over time error:", e);
			}finally {
				isRun = false;
			}
		}
	}
}
